<?php
/**
 * Created by PhpStorm.
 * User: crystal
 * Date: 2017/9/8
 * Time: 15:40
 */

namespace lib\DataAccess;


class SerializeFileAccess
{
    public function encode(Array $array)
    {
        if (empty($array) || count($array) == 0) {
            return '';
        }
        return serialize($array);
    }

    public function decode($str)
    {
        if (empty(trim($str))) {
            return [];
        }
        return unserialize($str);
    }
}